import java.util.ArrayList;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class Test10 {
    public static void main(String[] args) {
        ArrayList<String> list=new ArrayList<>();
        list.add("zhangsan-23");
        list.add("wangwu-25");
        list.add("lisi-24");
        Map<String,Integer> map=list.stream()
                .collect(Collectors.toMap(new Function<String, String>() {
                                              @Override
                                              public String apply(String e) {
                                                  String[] arr = e.split("-");
                                                  return arr[0];
                                              }
                                          },
                    new Function<String,Integer>(){
                        @Override
                        public Integer apply(String e){
                            return Integer.parseInt(e.split("-")[1]);
                        }
                    }));
        System.out.println(map);







                }
    }

